home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Technical Documentation / Sample Code / DTS_SCSI Code (In Development) / DTS_SCSI_IO.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-15  |  3.1 KB  |  103 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DTS_SCSI_IO.h
  3.     
  4.     
  5.     
  6.     
  7.     Unfortunately, no matter how long awaited, it's still not done.  In fact, this
  8. isn't even a release- this is just an image of the code taken in the middle of
  9. development.
  10.  
  11. THIS CODE DOES NOT WORK AS A WHOLE.  MUCH OF IT IS BUGGY AND / OR INCOMPLETE.
  12. YOU WOULD HAVE TO BE ABSOLUTELY INSANE TO USE ANY OF THIS CODE IN YOUR
  13. PROJECT WITHOUT EXTENSIVE THOUGHT, DEBUGGING AND TESTING.
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.     Contains:    Interface to our low-level SCSI routines, SCSIOp and SCSIPrime.
  21.  
  22.     Written by:    Mike Bell, Neil Day, Colleen Delgadillo, Tim Dierks, Dennis 
  23.                 Hescox, Craig Prouse, Kent Sandvik, Bryan Stearns
  24.  
  25.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  26.  
  27.     Change History (most recent first):
  28.  
  29.                  3/14/92    BJS        xxx put comment here xxx
  30.  
  31.     To Do:
  32. */
  33.  
  34. #ifndef __DTS_SCSI_IO__
  35. #define __DTS_SCSI_IO__
  36.  
  37. #ifndef __SCSI__
  38. #include <SCSI.h>
  39. #endif
  40.  
  41. // SCSI command bytes. There are others, but these are the ones we use.
  42. #define SCSICmd_TestUnitReady 0x00
  43. #define SCSICmd_Format 0x04
  44. #define SCSICmd_Read 0x08
  45. #define SCSICmd_Write 0x0A
  46. #define SCSICmd_Inquiry 0x12
  47. #define SCSICmd_ReadCap 0x25
  48.  
  49. // a SCSI address, 0-7 (except that 7 is the host Macintosh!)
  50. typedef short SCSIAddress;
  51.  
  52. // A six-byte SCSI Command Block
  53. typedef unsigned char SCSICommandBlock[6];
  54.  
  55. // A TransferInstructionBlock, a sequence of SCSIInstructions
  56. typedef SCSIInstr TransferInstructionBlock[];
  57.  
  58. // Handy shorthand for parameters to SCSIOp
  59. #define kDoWrite true
  60. #define kDoRead false
  61. #define kDoBlind true
  62. #define kDoPolled false
  63. #define kHoldIt true
  64. #define kUnholdIt false
  65. #define kIgnored false
  66. #define kNoBuffer NULL, 0, 0, kIgnored, kIgnored
  67. #define kNoLoop 0
  68.  
  69. // Timeouts (in ticks) for different kinds of SCSI operations
  70. #define kIOTimeout (60 * 60) /* a full minute for I/O operations */
  71. #define kFormatTimeout (60 * 60 * 60) /* an hour for formatting */
  72. #define kShortTimeout (1 * 60) /* one second for commands that we know are easy */
  73.  
  74. //
  75. // Function Prototypes
  76. //
  77.  
  78. // If calling the low-level code from an application, you have to hold
  79. // yourself and call this routine twice to hold the low-level SCSI code:
  80. // once before the SCSI operation with holdIt=true, and once after with
  81. // holdIt = false.
  82. extern OSErr HoldLowLevelCode(Boolean holdIt);
  83.  
  84. // Fill in a SCSI Command Block
  85. extern void StuffSCSICommandBlock(SCSICommandBlock cmd, unsigned char a, unsigned char b, 
  86.                 unsigned char c, unsigned char d, unsigned char e, unsigned char f);
  87.  
  88. // Fill in a Transfer Instruction Block
  89. extern void StuffTransferInstructionBlock(TransferInstructionBlock tib, void *buffer, unsigned
  90.                                     long blockSize, unsigned long loopCount);
  91.  
  92. // Perform a SCSI operation
  93. extern OSErr SCSIOp(SCSICommandBlock cmd, short cmdSize, short targetSCSIID, unsigned long 
  94.               completionTimeout,  void *buffer, unsigned long blockSize, 
  95.               unsigned long loopCount, Boolean writing, Boolean blind);
  96.  
  97. // Perform a SCSI blockread or write
  98. extern OSErr SCSIPrime(void *dataStart, short targetSCSIID, short targetUnit, unsigned long 
  99.                 startBlock, unsigned long *blockCountPtr, unsigned long blockSize, Boolean 
  100.                 writing, Boolean blind, unsigned long completionTimeout);
  101.  
  102. #endif
  103.